/**
 * ConcreteRequester.java
 * ************************** 
 * @date May 15, 2011
 * @author Michele Tamburini
 * 
 * **************************
 */
package infrastructureAPI;

import java.net.InetAddress;

/**
 * Description: 
 * This class implements the Requester interface and provide
 * only the basic features required by a Requester.
 * It stores the InetAddress of the requester node,
 * the Integer value of the rmiregistry port and the
 * String indicating the name of the registered service.
 *
 */
public class ConcreteRequester implements Requester {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	/**
	 * The InetAddress of the node that's acting as
	 * the node requester.
	 */
	protected InetAddress requesterAddress;
	
	/**
	 * The port through which the rmiregistry on the
	 * requester node is listening.
	 */
	protected Integer port;
	protected String registeredService;
	
	public ConcreteRequester(InetAddress reqNodeAddress, String registeredService,
			Integer port){
		this.requesterAddress = reqNodeAddress;
		this.registeredService = registeredService;
		this.port = port;
	}

	@Override
	public InetAddress getNodeAddress() {
		return requesterAddress;
	}

	@Override
	public String getRegisteredService() {
		return registeredService;
	}

	@Override
	public Integer getPort() {
		return port;
	}
	
	public String toString(){
		String ret = new String("");
		ret += requesterAddress + " "+port+" "+registeredService;
		return ret;
	}

}
